<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Editor</title>
  <style type="text/css" media="screen">
    body {
        overflow: hidden;
    }
    
    #editor { 
        margin: 0;
        position: absolute;
        top: 0;
        bottom: 10%;
        left: 10%;
        right: 10%;
    }
	#smt{
	margin:0;
	position:absolute;
	bottom:0;
	top: 90%;
    left: 0;
    right: 0;
	}
  </style>
  <script language="javascript">
  var editor;
  function submit()
  {
  	//alert(editor.getSession());
	document.getElementById("program").value=editor.getSession();
	document.getElementById("f1").submit();
  }
  
  </script>
</head>
<body>
<div id="editor"></div>
<div id="smt"><input type="button" value="Submit" onClick="submit()" style="position:absolute; left:30%; height:40px;font-size:24px;border:1px solid #e5e5e5;background:#fbfbfb; margin:4px"  /></div>
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="src/theme-eclipse.js" type="text/javascript" charset="utf-8"></script>
<script src="src/mode-c_cpp.js" type="text/javascript" charset="utf-8"></script>
<script>
window.onload = function() {
    editor = ace.edit("editor");
    editor.setTheme("ace/theme/eclipse");
    
    var c_cppMode = require("ace/mode/c_cpp").Mode;
    editor.getSession().setMode(new c_cppMode());
};
</script>
<form method="post" action="subcode.php" id="f1">
<input type="hidden" id="program" name="code">
</form>
</body>
</html>
